<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/jsp/includes.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>网站管理信息系统</title>
<link href="<c:url value='/css/admin/main.css'/>" rel="stylesheet" type="text/css"/>
<link href="<c:url value='/css/admin/uploadify/uploadify.css'/>" type="text/css" rel="stylesheet" />
<script src="<c:url value='/js/jquery-1.4.2.min.js'/>" type="text/javascript"></script>
<script type="text/javascript" src="<c:url value='/js/admin/uploadify/swfobject.js'/>"></script>
<script type="text/javascript" src="<c:url value='/js/admin/uploadify/jquery.uploadify.v2.1.4.min.js'/>"></script>
<script type="text/javascript">
$(document).ready(function() {
  $('#uploadify').uploadify({
    'uploader'  : '<c:url value="/images/uploadify/uploadify.swf"/>',
    'script'    : '<c:url value="/admin/ajaxFileUpload.nhtml"/>',
    'cancelImg' : '<c:url value="/images/uploadify/cancel.png"/>',
    'folder'    : '<c:url value="/customFile/upload"/>',
    'queueID'        : 'fileQueue',
    'auto'           : true,
    'multi'          : false,
    'simUploadLimit' : 1,
    'buttonText'     : 'BROWSE',
    onComplete:function(event, ID, fileObj, response, data){
    	//$("#img").empty();
    	$("#img").append("<img src='../../"+response+"'/>");
    	$("#productLogo").val(response);
    }
  });
});
</script>
</head>
<body>
<div class="columns">
    <jsp:include page="/admin/head.nhtml"/>
    <jsp:include page="/admin/menu.nhtml"/>
    <div class="col_main">
		<form:form modelAttribute="couponForm" method="post" id="productForm" action="productSave.nhtml"> 
			<form:hidden id="action" path="action"/>
			<div id="col_subview">
			    <div id="tool_box">
			        <span class="button button-main"><span><button type="button" onclick="Inote.Note.submit(this);">保存并关闭</button></span></span>
			        <span class="button button-main"><span><button type="submit" name="submitBtn">立即保存</button></span></span>
			        <span class="button-cancel" style="padding-left: 40px"><a href="javascript:void(0)" onclick="Inote.Note.cancel();">取消编辑</a></span>
			    </div>
			</div>
			<div style="top: 43px;" id="col_viewer" class="col_container">
		        <dl class="fieldset note_form container">
		        	<dt><label>编码：</label></dt>
		        	<dd><form:input cssClass="input" id="productCode" path="product.code" maxlength="40"/></dd>
		            <dt><label>名称：</label></dt>
		            <dd><form:input cssClass="input" id="productName" path="product.name" maxlength="40"/></dd>
		            <dt><label>logo：</label></dt>
		            <dd>
		            <div>
		            	 <div id="img" style="width:64px;height:64px;border:1px solid #cccccc;float:left;margin-right:20px">
		            	 	<img src = "<c:url value='${couponForm.product.logo}'/>"/>
		            	 </div>
		            	 <div style="float:left;margin-right:10px">
		            	 <form:hidden id="productLogo" path="product.logo"/>
				         <input type="file" name="uploadify" id="uploadify" />
				         </div>
		            	 <div id="fileQueue" style="float:left" ></div>
		            </div>
		            </dd>
		        </dl>
			</div>
		</form:form>
	</div>
	<jsp:include page="/admin/foot.nhtml"/>
</div>
</body>
</html>